home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
system
/
sysprof3.zip
/
ORIGINAL.ARC
/
PROFCTRL.C
next >
Wrap
C/C++ Source or Header
|
1988-06-16
|
20KB
|
492 lines
/*****************************************************************************/
/* */
/* Listing 2 */
/* */
/* NAME : PROFCTRL */
/* */
/* DATE : March 30, 1988 */
/* */
/* AUTHOR : (C) Copyright 1988 G. Kent Cobb - All Rights Reserved */
/* */
/* DESCRIPTION : */
/* This program provides control functions for the terminate-and-stay- */
/* resident system profiler. The syntax for executing PROFCTRL is: */
/* */
/* */
/* | STATUS | */
/* | ON | */
/* PROFCTRL | OFF | */
/* | ZERO | */
/* | REPORT [output-file-name] | */
/* */
/* The ON and OFF options affect the accumulation of interrupt data; */
/* STATUS reports the current state; ZERO erases all data that has */
/* been accumulated; and REPORT generates a listing that describes */
/* the contents of the tables. */
/* */
/* SYS_PROF and PROFCTRL are most easily used in a batch file, such as: */
/* */
/* */
/* SYS_PROF */
/* PROFCTRL zero */
/* PROFCTRL on */
/* chkdsk c: */
/* PROFCTRL off */
/* PROFCTRL report temp */
/* d:list temp */
/* */
/*****************************************************************************/
#include "stdio.h"
#include "dos.h"
#define NUM_INTS 9
#define END_OF_STRING '\0'
#define CONTROL_INTERRUPT 96
#define STATUS 0
#define OFF 1
#define ON 2
#define FIND 3
#define ZERO 4
#define REPORT 5
#define DOS 0x21
#define GET_INT_VECTOR 0x35
struct tally
{
long time;
long number;
};
long total_ticks; /* TOTAL NUMBER OF TIMER TICKS RECORDED. */
char *int_desc[NUM_INTS+1] = {"OTHER",
"PRINT SCREEN - INTERRUPT 5H",
"VIDEO BIOS - INTERRUPT 10H",
"DISK SERVICES - INTERRUPT 13H",
"COMM PORT - INTERRUPT 14H",
"KEYBOARD BIOS - INTERRUPT 16H",
"PRINTER BIOS - INTERRUPT 17H",
"DOS FUNCTIONS - INTERRUPT 21H",
"DOS ABSOLUTE DISK READ - INTERRUPT 25H",
"DOS ABSOLUTE DISK WRITE - INTERRUPT 26H" };
int max_services[NUM_INTS+1] = {0,0,20,24,4,3,3,99,0,0};
char *other_services[] = {""};
char *print_screen_services[] = {""};
char *video_services[] = {"00 - Set Mode",
"01 - Set Cursor Size",
"02 - Set Cursor Position",
"03 - Get Cursor Position",
"04 - Get Light Pen Position",
"05 - Set Active Page",
"06 - Scroll Up",
"07 - Scroll Down",
"08 - Read Character and Attribute",
"09 - Write Character and Attribute",
"0A - Write Character",
"0B - Set Palette",
"0C - Write Dot",
"0D - Read Dot",
"0E - Write TTY",
"0F - Get Mode",
"10 - Service 16",
"11 - Service 17",
"12 - Service 18",
"13 - Write String",
"Undefined services"};
char *disk_services[] = {"00 - Reset Diskette System",
"01 - Get Diskette Status",
"02 - Read Sectors",
"03 - Write Sectors",
"04 - Verify Sectors",
"05 - Format Track",
"06 - Service 6",
"07 - Service 7",
"08 - Get Drive Parameters",
"09 - Initialize Parameter Tables",
"0A - Read Long",
"0B - Write Long",
"0C - Seek to Cylinder",
"0D - Alternate Disk Reset",
"0E - Service 14",
"0F - Service 15",
"10 - Test Ready",
"11 - Recalibrate Drive",
"12 - Service 18",
"13 - Service 19",
"14 - Controller Diagnostics",
"15 - Get Disk Type",
"16 - Change Disk Status",
"17 - Set Disk Type",
"Undefined services"};
char *comm_services[] = {"00 - Initialize Serial Port",
"01 - Send Character",
"02 - Receive Character",
"03 - Get Status",
"Undefined services"};
char *keyboard_services[] = {"00 - Read Character",
"01 - Character Waiting?",
"02 - Get Shift Status",
"Undefined services"};
char *printer_services[] = {"00 - Send Byte",
"01 - Initialize Printer",
"02 - Get Printer Status",
"Undefined services"};
char *dos_services[] = {"00 - Terminate",
"01 - Keyboard Input With Echo",
"02 - Display Output",
"03 - Serial Input",
"04 - Serial Output",
"05 - Printer Output",
"06 - Keyboard/Display I/O",
"07 - Keyboard Input No Echo",
"08 - Keyboard Input No Echo",
"09 - Display String",
"0A - Buffered Keyboard Input",
"0B - Keyboard Status",
"0C - Clear Keyboard",
"0D - Reset Disk",
"0E - Set Default Drive",
"0F - Open File FCB Mode",
"10 - Close File FCB Mode",
"11 - Find First File FCB Mode",